package com.naiterui.ehp.bp.domain.education;

import static javax.persistence.GenerationType.IDENTITY;

import java.io.Serializable;
import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.Version;

import org.hibernate.annotations.DynamicInsert;
import org.hibernate.annotations.DynamicUpdate;

/**
 * 宣教基础信息

 * @version 2017年3月29日 by wangchuan
 */
@Entity
@Table(name = "edu_info")
@DynamicInsert// 使用数据库的默认值
@DynamicUpdate
public class EduInfo implements Serializable {

    /** 宣教类型：1.个性化 */
    public static final Integer EDU_TYPE_PRIVATE = 1;
    /** 宣教类型：2.公共 */
    public static final Integer EDU_TYPE_PUBLIC = 2;
    /** 宣教类型：3.普适性 */
    public static final Integer EDU_TYPE_COMMON = 3;

    /** 宣教有效性：0.正常 */
    public static final Integer IS_AVAILABLE_TRUE = 0;
    /** 宣教有效性：1.已删除 */
    public static final Integer IS_AVAILABLE_FALSE = 1;

    /** 是否有科室标签：1.是 */
    public static final Integer HAS_DEPT_TRUE = 1;
    /** 是否有科室标签：0.否 */
    public static final Integer HAS_DEPT_FALSE = 0;

    private static final long serialVersionUID = -5203621350795891057L;

    @Id
    @GeneratedValue(strategy = IDENTITY)
    @Column(name = "id", unique = true, nullable = false)
    private Long id;

    @Column(name = "edu_title")
    private String eduTitle;        // 宣教标题

    @Column(name = "edu_origin")
    private String eduOrigin;       // 宣教来源

    @Column(name = "edu_url")
    private String eduUrl;          // 宣教URL

    @Column(name = "edu_type", columnDefinition = "bit", length = 1)
    private Integer eduType;            // 宣教类型：1.个性化宣教 2.公共宣教 3.普适性宣教

    @Column(name = "has_dept", columnDefinition = "bit", length = 1)
    private Integer hasDept;            // 是否有科室标签：0.无 1.有

    @Column(name = "is_available", columnDefinition = "bit", length = 1)
    private Integer isAvailable;        // 是否有效： 0.正常 1.已删除

    @Column(name = "created_at")
    private Date createdAt;         // 创建时间

    @Column(name = "changed_at")
    private Date changedAt;         // 修改时间

    @Column(name = "created_by")
    private String createdBy;       // 创建人

    @Column(name = "changed_by")
    private String changedBy;       // 修改人

    @Version
    private Integer version;

    public EduInfo() {

    }

    public EduInfo(String eduTitle, String eduOrigin, String eduUrl, Integer eduType, Integer hasDept) {
        this.eduTitle = eduTitle;
        this.eduOrigin = eduOrigin;
        this.eduUrl = eduUrl;
        this.eduType = eduType;
        this.hasDept = hasDept;
        this.isAvailable = EduInfo.IS_AVAILABLE_TRUE;
        this.createdAt = new Date();
        this.createdBy = "system";
    }

    public Long getId() {
        return this.id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public String getEduTitle() {
        return this.eduTitle;
    }

    public void setEduTitle(String eduTitle) {
        this.eduTitle = eduTitle;
    }

    public String getEduOrigin() {
        return this.eduOrigin;
    }

    public void setEduOrigin(String eduOrigin) {
        this.eduOrigin = eduOrigin;
    }

    public String getEduUrl() {
        return this.eduUrl;
    }

    public void setEduUrl(String eduUrl) {
        this.eduUrl = eduUrl;
    }

    public Integer getEduType() {
        return this.eduType;
    }

    public void setEduType(Integer eduType) {
        this.eduType = eduType;
    }

    public Integer getIsAvailable() {
        return this.isAvailable;
    }

    public void setIsAvailable(Integer isAvailable) {
        this.isAvailable = isAvailable;
    }

    public Date getCreatedAt() {
        return this.createdAt;
    }

    public void setCreatedAt(Date createdAt) {
        this.createdAt = createdAt;
    }

    public Date getChangedAt() {
        return this.changedAt;
    }

    public void setChangedAt(Date changedAt) {
        this.changedAt = changedAt;
    }

    public String getCreatedBy() {
        return this.createdBy;
    }

    public void setCreatedBy(String createdBy) {
        this.createdBy = createdBy;
    }

    public String getChangedBy() {
        return this.changedBy;
    }

    public void setChangedBy(String changedBy) {
        this.changedBy = changedBy;
    }

    public Integer getVersion() {
        return this.version;
    }

    public void setVersion(Integer version) {
        this.version = version;
    }

    public Integer getHasDept() {
        return this.hasDept;
    }

    public void setHasDept(Integer hasDept) {
        this.hasDept = hasDept;
    }

}
